'use strict'

$(document).ready(function(e) {
    $('.btn-agree').click(function(e) {
        var $dialog = $(this).parents('#stripChecking');

        var applyId = $dialog.attr('data-id');

        var request = new Request('/teacher/absence_apply/update');
        request.postJSON({
            apply: {
                id: applyId,
                status: 1
            }
        }, function(data) {
            console.log(data);
            if ( data.successful ) {
                alert('批准假条成功');
                var request = new Request(location.href);
                var response = new Response();
                response.redirectTo(request);
            }
            else {
                alert('批准假条失败');
            }
        });
    });
});
